﻿/// <reference path="turbo_common.js" />
/// <reference path="../General/Json.js" />
/// <reference path="ResponseUpdatePanelInclude.js" />

var $ResponseUpdatePanelIncludeCollection = TA.Turbo.Common.ResponseUpdatePanelIncludeCollection = function ResponseUpdatePanelIncludeCollection()
{
}
$ResponseUpdatePanelIncludeCollection.Inherit(JsonCompatibleCollection);

$ResponseUpdatePanelIncludeCollection.prototype.CreateOneItem = function CreateOneItem(value)
{
	return new $ResponseUpdatePanelInclude();
}

$ResponseUpdatePanelIncludeCollection.prototype.Process = function Process()
{
	var existingIncludes = new Object();

	var scriptTags = document.getElementsByTagName("SCRIPT");
	for (var iScriptTag = 0; iScriptTag < scriptTags.length; ++iScriptTag)
	{
		existingIncludes[scriptTags[iScriptTag].src.replace(location.protocol + "//" + location.hostname, "")] = true;
	}

	var linkTags = document.getElementsByTagName("LINK");
	for (var iLinkTag = 0; iLinkTag < linkTags.length; ++iLinkTag)
	{
		if (linkTags[iLinkTag].rel.toLowerCase() == "stylesheet")
			existingIncludes[linkTags[iLinkTag].href.replace(location.protocol + "//" + location.hostname, "")] = true;
	}


	for (var i = 0; i < this.length; ++i)
	{
		this[i].Process(existingIncludes);
	}
}
